package com.android.djlmapp.adapter.msg;

import android.content.Context;
import android.widget.TextView;

import com.android.djlmapp.R;
import com.android.djlmapp.model.msg.MessageEntity;
import com.android.djlmapp.tools.TimeUtils;

import org.refresh_view.pullrecyclerview.BaseRecyclerAdapter;
import org.refresh_view.pullrecyclerview.BaseViewHolder;

import java.util.ArrayList;

/**
 * @name djlm
 * @class name：com.android.djlmapp.adapter
 * @class describe: 消息列表adapter
 * @anthor wangziheng
 * @time 2017/4/24 20:09
 * @change
 * @chang time
 * @class describe
 */
public class SystemMsgListAdapter extends BaseRecyclerAdapter<MessageEntity.SandMessageBean> {

    public SystemMsgListAdapter(Context context) {
        super(context, R.layout.system_msg_list_item_layout, new ArrayList<>());
    }

    @Override
    protected void convert(BaseViewHolder holder, MessageEntity.SandMessageBean item) {
        TextView msgTime = holder.itemView.findViewById(R.id.msg_list_time);
        TextView msgTitle = holder.itemView.findViewById(R.id.msg_list_title);


        if ("1".equals(item.getIs_read())) {
            msgTime.setTextColor(mContext.getResources().getColor(R.color.homeTextDanGray));
            msgTitle.setTextColor(mContext.getResources().getColor(R.color.homeTextDanGray));
        } else {
            msgTitle.setTextColor(mContext.getResources().getColor(R.color.black));
            msgTime.setTextColor(mContext.getResources().getColor(R.color.black));
        }
        msgTitle.setText(item.getTitle());
        msgTime.setText(TimeUtils.timedate(item.getSend_time()));
    }
}
